<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui" contentType="text/html">

<html>
	
	<h:head> 
		<title> Rede de Imóveis </title>	
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
		<h:outputScript library="jquery" name="jquery-1.2.6.js" />
		<h:outputScript library="jquery/imob" name="super.js" />
		<h:outputStylesheet library="css" name="myform.css" />
	</h:head>

<h:body>
	<h2>Cadastrar Empresa</h2>
	<hr />
	<h:form prependId="false" >
		<h:messages />
		
		<div id="form" >
			<p>
				<label for="fantasia" >Fantasia:</label>
				<p:inputText id="fantasia" required="true" 
							size="30" value="#{empresaBO.empresa.fantasia}" />
			</p>	
			
			<p>
				<label for="rzsocial">Razão Social:</label>
				<p:inputText id="rzsocial" title="Razão Social" 
							value="#{empresaBO.empresa.razaoSocial}"  
							required="true" size="30"/>
			</p>
				
			<p>
				<label for="iestado" >Inscrição Social:</label>
				<p:inputMask id="iestado" mask="999.999.999.999"
							value="#{empresaBO.empresa.inscricaoEstado}" 
							required="false" size="30"/>
			</p>
			
			<p>
				<label for="cnpj" >Cnpj:</label>
				<p:inputMask id="cnpj" value="#{empresaBO.empresa.cnpj}" 
							mask="99.999.999/9999-99" required="true" />
			</p>
			
			<!-- LOGIN -->
			<p>
				<label for="login" >User:</label>
				<p:inputText id="login" value="#{empresaBO.login.login}"
							required="true" size="10" />
			</p>
				
			<p class="recoil">
				<label for="senha" >Senha:</label>
				<h:inputSecret id="senha" value="#{empresaBO.login.senha}"
						styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all"
						size="10" required="true"/>
			</p>
			
			<p>
				<label for="email" >Email:</label>
				<p:inputText id="email" value="#{empresaBO.login.email}" 
							required="true" size="30"/>
			</p>
			
			<p>
				<label for="site" >Site:</label>
				<p:inputText id="site" value="#{empresaBO.login.site}"
							required="false" size="30"/>
			</p>
			
			<!-- CONTATO -->
			<p>
				<label for="fone" >Telefone:</label>
				<p:inputMask id="fone" value="#{empresaBO.contato.telefone}" 
						 	mask="(99) 9999-9999" required="false" />
			</p>
			<p>
				<label for="comercial" >Telefone Comercial:</label>
				<p:inputMask id="comercial" value="#{empresaBO.contato.comercial}" 
						mask="(99) 9999-9999? x99999" required="false" />
			</p>
				
			<p>
				<label for="celular" >Celular:</label>
				<p:inputMask id="celular" value="#{empresaBO.contato.celular}" 
							mask="(99) 9999-9999" required="true" />
			</p>
			<p>
				<label for="fax" >Fax:</label>
				<p:inputMask id="fax" value="#{empresaBO.contato.fax}" 
						mask="(99) 9999-9999? x99999" required="false" />
			</p>	
			
			<!-- LOCALIDADE -->
			<p>
				<label for="bairro" >Bairro:</label>
				<p:inputText id="bairro" value="#{empresaBO.bairro.bairro}" 
							required="true" />
			</p>
							
			<p>
				<label for="estado" class="eside">Estado:</label>
				<h:selectOneMenu id="estado" value="#{empresaBO.estado.estado}"
								styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all "
								required="true">
							<f:selectItem itemLabel="Selecione Estado" itemValue="" />	
							<f:selectItems value="#{empresaBO.listEstados}" />
							<f:ajax event="valueChange" render="cities" listener="#{empresaBO.getEstadoSelected}"/>
				</h:selectOneMenu>
			</p>
				
			<p>
				<label for="cep" >Cep:</label>
				<p:inputMask id="cep" value="#{empresaBO.bairro.cep}" 
						mask="99.999-999" required="true" />
			</p>
	
			<p>
				<label for="cities" class="eside">Cidade:</label>
				<h:selectOneMenu id="cities" value="#{empresaBO.cidade.cidade}"
								styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all ">
							<f:converter converterId="br.com.imob.view.Object" />
							<f:selectItem itemLabel="Selecione Cidade" itemValue="" />
							<f:selectItems value="#{empresaBO.listCidades}" var="city" itemValue="#{city.cidade}"/>
				</h:selectOneMenu>
			</p>
				
			<p>
				<label for="Endereco" >Endereco:</label>
				<p:inputText id="Endereco" value="#{empresaBO.endereco.endereco}" size="30"/>
			</p>
			
			<p>
				<label for="complemento" >Complemento:</label>
				<p:inputText id="complemento" value="#{empresaBO.endereco.complemento}" size="30"/>
			</p>
			
		</div>
		<div class="button">
			<h:commandButton id="btnReset" value="Limpar" type="reset"/>
			<h:commandButton id="btnCancel" value="Cancelar" type="button" />
			<h:commandButton value="Cadastrar" actionListener="#{empresaBO.adicionarEmpresa}"/>
		</div>
		
	</h:form>
</h:body>
</html>

</f:view>